package com.magic.interview.二分.LC69X的平方根;

class Solution {
    public int mySqrt(int x) {
        int l = 0;
        int r = x;
        while (l < r) {
            int mid = l + r + 1 >> 1;
            if (mid <= x / mid) {
                l = mid;
            } else {
                r = mid - 1;
            }
        }
        return r;
    }
}